/* Copyright (c) 2024 Li Jin, dragon-fly@qq.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */

import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';

i18n
	.use(initReactI18next)
	.init({
		resources: {
			en: {
				translation: {
					spine: {
						load: "failed to load {{file}}",
					},
					tree: {
						assets: "Assets",
						builtin: "Builtin",
					},
					alert: {
						assetLoad: "failed to load assets",
						platform: "Dora SSR is running on {{platform}}",
						getInfo: "failed to get basic info",
						builtin: "can not operate on built-in assets",
						read: "failed to read {{title}}",
						open: "failed to open files",
						unsuppored: "unsupported file {{title}}",
						reloading: "please save before reloading assets",
						reloaded: "assets reloaded",
						save: "failed to save {{title}}",
						saveCurrent: "failed to save current file",
						deleteRoot: "can not delete root folder",
						deleted: "deleted {{title}}",
						delete: "failed to delete item",
						deleteNoTarget: "select a file tree node to delete",
						downloadWait: "wait for previous download to finish",
						downloadStart: "wait for download to start",
						downloadFailed: "failed to prepare download",
						renameSave: "please save all files before renaming",
						renameRoot: "can not rename root folder",
						renameFailed: "failed to rename item",
						renamed: "renamed {{oldFile}} to {{newFile}}",
						newFailed: "failed to create item",
						newNoTarget: "select a file tree node before creating new file",
						movingNoSave: "please save all files before moving",
						movingFailed: "failed to move {{from}} to folder {{to}}",
						moved: "{{from}} moved to folder {{to}}",
						stopped: "stopped running",
						stopNone: "nothing to stop",
						stopFailed: "failed to stop running",
						runNoTarget: "please select a file to run",
						run: "{{title}} is running",
						runFailed: "failed to run {{title}}",
						startUnzip: "start to unzip file {{title}}",
						doneUnzip: "finished unziping file {{title}}",
						failedUnzip: "failed to unzip file {{title}}, make sure it's a ZIP and no same named folder exist",
						failedTS: "TypeScript compile error, check log for details",
						failedCompile: "not generated {{title}}",
						copied: "copied path {{title}}",
						copy: "failed to copy path",
						tocopy: "Relative path for {{title}}",
					},
					popup: {
						goToFile: "Go to File",
						closingTab: "Closing Tab",
						closingNoSave: "close tab without saving",
						moving: "Moving Item",
						movingInfo: "move {{from}} to folder {{to}}",
					},
					upload: {
						text: "Click to select a folder or drag files to this area to upload automatically.",
						hint: "For files exceeding 100, upload a ZIP then do decompressing instead.",
						selectFile: "Select File",
						uploading: "Uploading",
						startUpload: "Start Upload",
						success: "Upload successfully.",
						failed: "Upload failed.",
						exceeded: "Files to upload exceeded 100.",
					},
					action: {
						"ok": "OK",
						"cancel": "Cancel",
						"confirm": "Confirm",
						"clear": "Clear",
						"close": "Close",
					},
					file: {
						new: "New File",
						newFolder: "New Folder",
						rename: "Rename",
						enterFile: "Enter a file name",
						enterFolder: "Enter a folder name",
						deleteFile: "deleting file {{name}}",
						deleteFolder: "deleting folder {{name}}",
						lua: "lightweight, high-level, multi-paradigm language",
						yuescript: "expressive, extremely concise language",
						teal: "a typed dialect of Lua",
						typescript: "a strongly typed language with better coding experience",
						xml: "write game node trees in XML format",
						markdown: "do some documentation",
						folder: "create a file folder",
						yarn: "a language for game dialogue",
						visualScript: "write game logic by connecting visual nodes together",
					},
					editor: {
						goToDefinition: "Go to Definition",
						require: "Import this module",
					},
					menu: {
						version: "Dora SSR version {{version}}",
						new: "New",
						delete: "Delete",
						rename: "Rename",
						download: "Download",
						save: "Save",
						saveAll: "Save All",
						close: "Close",
						closeAll: "Close All",
						closeOthers: "Close Others",
						run: "Run",
						runThis: "Run This",
						stop: "Stop",
						goToFile: "Go to File",
						extract: "Unzip",
						viewLog: "View Log",
						viewCompiled: "View {{lang}}",
						copyPath: "Copy Path",
					},
					log: {
						wait: "Wait for logging messages ...",
						open: "Dora SSR connected!",
						close: "Dora SSR disconnected!",
						command: "Commandline"
					},
				}
			},
			zh: {
				translation: {
					spine: {
						load: "加载 {{file}} 失败",
					},
					tree: {
						assets: "资源根目录",
						builtin: "内置资源目录",
					},
					alert: {
						assetLoad: "资源加载失败",
						platform: "Dora SSR 正运行于 {{platform}} 平台",
						getInfo: "获取基本信息失败",
						builtin: "无法操作内置资源",
						read: "读取 {{title}} 失败",
						open: "打开文件失败",
						unsuppored: "暂不支持预览文件 {{title}}",
						reloading: "请在重新加载资源之前保存",
						reloaded: "资源已重新加载",
						save: "保存 {{title}} 失败",
						saveCurrent: "保存当前文件失败",
						deleteRoot: "无法删除资源的根目录",
						deleted: "{{title}} 已删除",
						delete: "删除文件失败",
						deleteNoTarget: "请选择要删除的文件树节点",
						downloadWait: "请等待上一个下载完成",
						downloadStart: "请等待下载开始",
						downloadFailed: "下载准备失败",
						renameSave: "请在重命名之前保存所有文件",
						renameRoot: "无法重命名根目录文件夹",
						renameFailed: "重命名文件失败",
						renamed: "{{oldFile}} 已重命名为 {{newFile}}",
						newFailed: "创建文件失败",
						newNoTarget: "请选择要创建新文件的文件树节点",
						movingNoSave: "请在移动文件之前保存所有文件",
						movingFailed: "移动 {{from}} 到文件夹 {{to}} 失败",
						moved: "已移动 {{from}} 到目录 {{to}}",
						stopped: "已停止正在运行的文件或项目",
						stopNone: "没有正在运行的文件或项目",
						stopFailed: "停止运行失败",
						runNoTarget: "请选择要运行的文件或项目",
						run: "{{title}} 正在运行",
						runFailed: "运行 {{title}} 失败",
						startUnzip: "开始解压缩 {{title}}",
						doneUnzip: "完成解压缩 {{title}}",
						failedUnzip: "解压缩 {{title}} 失败，请确认为 ZIP 文件且目录下无同名文件夹",
						failedTS: "TypeScript 编译报错，请查看日志",
						failedCompile: "待生成 {{title}}",
						copied: "已复制路径 {{title}}",
						copy: "复制路径失败",
						tocopy: "{{title}} 的相对路径",
					},
					popup: {
						goToFile: "跳转到文件",
						closingTab: "关闭标签中",
						closingNoSave: "标签未保存，是否确认关闭",
						moving: "移动文件",
						movingInfo: "将移动 {{from}} 到目录 {{to}}",
					},
					upload: {
						text: "点击选择上传的文件夹，或拖拽文件到这里进行自动批量上传。",
						hint: "超过100个文件的批量上传，请上传 ZIP 包再做解压。",
						selectFile: "选择文件",
						uploading: "上传中",
						startUpload: "开始上传",
						success: "上传成功。",
						failed: "上传失败。",
						exceeded: "批量上传文件一次不能超过100个。",
					},
					action: {
						"ok": "确定",
						"cancel": "取消",
						"confirm": "确认",
						"clear": "清空",
						"close": "关闭",
					},
					file: {
						new: "新建文件",
						newFolder: "新建文件夹",
						rename: "重命名",
						enterFile: "请输入文件名",
						enterFolder: "请输入文件夹名",
						deleteFile: "是否删除文件 {{name}}",
						deleteFolder: "是否删除文件夹 {{name}}",
						lua: "轻量级、高层级、多范式的编程语言",
						yuescript: "富有表达力且极为简洁的编程语言",
						teal: "静态类型的一种Lua方言编程语言",
						typescript: "提供更好编码体验的强类型编程语言",
						xml: "用标记语言来编写游戏节点树",
						markdown: "来写一些文档吧",
						folder: "创建文件夹",
						yarn: "用于编写游戏对话的语言",
						visualScript: "通过将可视化节点连接在一起来写游戏逻辑",
					},
					editor: {
						goToDefinition: "跳转到定义",
						require: "导入该模块",
					},
					menu: {
						version: "Dora SSR 版本号 {{version}}",
						new: "新建",
						delete: "删除",
						rename: "重命名",
						download: "下载",
						save: "保存",
						saveAll: "全部保存",
						close: "关闭",
						closeAll: "全部关闭",
						closeOthers: "关闭其它",
						run: "运行",
						runThis: "运行文件",
						stop: "停止",
						goToFile: "跳转到文件",
						extract: "解压缩",
						viewLog: "查看日志",
						viewCompiled: "查看 {{lang}}",
						copyPath: "复制路径",
					},
					log: {
						wait: "接收日志消息中……",
						open: "Dora SSR 已连接！",
						close: "Dora SSR 断开连接！",
						command: "命令行"
					},
				}
			},
		},
		fallbackLng: 'en',
		preload: ['en', 'zh'],
		interpolation: {
			escapeValue: false,
		},
	});

export default i18n;
